<script type="text/javascript">
function validate_form() {
    var fullname = $('#fullname').val();
    var description = $('#description').val();
    var captcha = $('#captcha').val();
    var countError = 0;
    
    if((fullname.length < 1) || (fullname.length > 100)) {
        $('#errorFullname').html('Họ và tên phải từ 1-100 kí tự');
        countError++;
    }
    else {
        $('#errorFullname').html('');
    }
    if(description == '') {
        $('#errorDescription').html('Bạn chưa nhập nội dung');
        countError++;
    }
    else {
        $('#errorDescription').html('');
    }
    if(captcha == '') {
        $('#errorCaptcha').html('Bạn chưa nhập mã xác nhận');
        countError++;
    }
    else {
        $('#errorCaptcha').html('');
    }
    
    if(countError > 0) {
        return false;
    }
    else {
        return true;
    }
}
</script>
<div class="main-blocks">
    <div class="heading-main-blocks">
        <h4>Đánh giá của bạn về chúng tôi</h4>
    </div>
    
    <div class="content-main-blocks">
        <div class="form-evaluation">
            <form action="" method="post" onsubmit="return validate_form()">
            <?php echo $this->formHidden('captcha_id',$this->captchaID); ?>
                <table>
                    <tr>
                        <td style="width: 410px;">
                            <p><?php echo $this->formLabel('fullname', 'Họ và tên'); ?><span class="error-msg">*</span></p>
                            <?php echo $this->formText('fullname',$this->fullnameValue,array('class'=>'input')); ?>
                        </td>
                        <td><span class="error-msg" id="errorFullname"><?php echo $this->errorFullname; ?></span></td>
                    </tr>
                    <tr>
                        <td>
                            <p><?php echo $this->formLabel('description', 'Nội dung'); ?><span class="error-msg">*</span></p>
                            <?php echo $this->formTextarea('description',$this->descriptionValue,array('class'=>'textarea')); ?>
                        </td>
                        <td><span class="error-msg" id="errorDescription"><?php echo $this->errorDescription; ?></span></td>
                    </tr>
                    <tr>
                        <td>
                            <div style="clear:both; float: left;">
                                <p><?php echo $this->formLabel('captcha', 'Nhập mã xác nhận'); ?><span class="error-msg">*</span></p>
                                <?php echo $this->formText('captcha',null,array('class'=>'input','style'=>'width: 120px')); ?>
                            </div>
                            <div style="float: left; position: relative; margin: 10px 0 0 10px;"><?php echo $this->captcha; ?></div>
                        </td>
                        <td><span class="error-msg" id="errorCaptcha"><?php echo $this->errorCaptcha; ?></span></td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="submit" name="submit" value="Gửi đánh giá" class="input-button" /></td>
                    </tr>
                </table>
            </form>
        </div>
        <!-- End .form-evaluation -->
        
        <?php
            if(count($this->data) > 0) :
            $common = new Admincp_Model_Common();
        ?>
        <div class="list-evaluation">
        <?php foreach($this->data as $value) : ?>
            <div class="evaluations">
                <p class="fullname-evaluations"><?php echo $value['fullname']; ?></p>
                <div class="description-evaluations">
                    <?php echo $value['description']; ?>
                </div>
                <p class="date-evaluations">Ngày đăng: <?php echo $common->formatDateSite($value['create_date']); ?></p>
            </div>
            <!-- End .evaluations -->
        <?php endforeach; ?>
        </div>
        <!-- End .list-evaluation -->
        <?php endif; ?>
        
        <?php if(count($this->data) > 0) : ?>
        <div class="pagination">
            <?php
                echo $this->paginationControl($this->data, 'Sliding', 'evaluation/pagination.phtml');
            ?>
        </div>
        <?php endif; ?>
    </div>
</div>
<!-- End .main-blocks -->